package com.venutech.gongan.dto.rpc.common;

public enum WorkType {

    Report(1, "事件上报"),
    EarlyWarningApplication(2, "人脸识别申请"),
    VideoPrivilegeApplication(3, "视频权限申请"),
    Patrol(4, "巡检打卡");

    private int value;
    private String typeName;

    WorkType(int value, String typeName) {
        this.typeName = typeName;
        this.value = value;
    }

    public static String getNameByValue(int value) {
        for (WorkType item : WorkType.values()) {
            if (item.getValue() == value) {
                return item.getTypeName();
            }
        }
        return "";
    }

    public static WorkType getUserTypeByValue(int value) {
        WorkType workType = WorkType.Report;
        if (value == WorkType.Report.getValue()) {
            workType = WorkType.Report;
        } else if (value == WorkType.EarlyWarningApplication.getValue()) {
            workType = WorkType.EarlyWarningApplication;
        } else if (value == WorkType.VideoPrivilegeApplication.getValue()) {
            workType = WorkType.VideoPrivilegeApplication;
        } else if(value == WorkType.Patrol.getValue()) {
            workType = WorkType.Patrol;
        }

        return workType;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

}
